package logic

import (
	"context"
	"novel/model/mysql"

	"novel/novelrpc/internal/svc"
	"novel/novelrpc/novelrpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type BookshelfDelLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewBookshelfDelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *BookshelfDelLogic {
	return &BookshelfDelLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *BookshelfDelLogic) BookshelfDel(in *novelrpc.BookshelfDelRequest) (*novelrpc.BookshelfDelResponse, error) {
	// todo: add your logic here and delete this line

	var user mysql.Bookshelf

	mysql.DB.Debug().Where("user.id = ?", in.BookshelfId).Delete(&user)

	return &novelrpc.BookshelfDelResponse{}, nil
}
